﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using Lamex.Library;

namespace Lamex.mIE.UI
{
    public partial class frmIE_Layout_Lamex : frmBaseChild
    {
        public frmIE_Layout_Lamex()
        {
            InitializeComponent();
            //this.pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
            //this.pictureBox1.BorderStyle = BorderStyle.Fixed3D;
            //this.pictureBox1.Location = new Point(0, 0);
        }
        Bitmap srcImg;      //原始图片
        Bitmap infoImg;     //参考图片
        TextBox myText;       //显示信息
        private void frmIE_Layout_Lamex_Load(object sender, EventArgs e)
        {
            Image srcImage = Lamex.mIE.Properties.Resources.Lamex_Factory_Layout_Up;
            Image infoImage = Lamex.mIE.Properties.Resources.Lamex_Factory_Layout_Down;
            srcImg = new Bitmap(srcImage);        //加载图像
            infoImg = new Bitmap(infoImage);
            pictureBox1.Image = srcImg;                 //显示原图 - -！、尼玛感觉srcImage创建出来是多余的
            pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
            //this.Width = pictureBox1.Width + (this.Bounds.Width - this.ClientSize.Width);
            //this.Height = pictureBox1.Height + (this.Bounds.Height - this.ClientSize.Height);
            //设置label
            myText = new TextBox();
            this.Controls.Add(myText);
            myText.Multiline = true;
            myText.Enabled = false;
            myText.Parent = pictureBox1;
            //myText.BackColor = Color.FromArgb(150, 0, 0, 0);
            //myText.ForeColor = Color.White;
            myText.Width = 120;
            myText.Height = 48;
        }

        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            Color clr = infoImg.GetPixel(e.X, e.Y);         //获取在参考图对应坐标像素点的颜色信息
            //if (clr.ToArgb() != Color.Black.ToArgb())
            if (clr.ToArgb() != Color.White.ToArgb())
                {
                myText.Visible = true ; 
                myText.Text = "";
                pictureBox1.Cursor = Cursors.Hand;          //设置手形
                if (clr.ToArgb() == Color.FromArgb(255, 0xB2,0xBE,0xC3).ToArgb())
                    myText.Text = "D01_自动仓"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xFF,0xA5,0x2).ToArgb())
                    myText.Text = "D04_LS1"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x7B,0xED,0x9F).ToArgb())
                    myText.Text = "D07_COMBIMA"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x2E,0xD5,0x73).ToArgb())
                    myText.Text = "D11_PuH"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xFF,0x7F,0x50).ToArgb())
                    myText.Text = "D14_FH4"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xA5,0xB1,0xC2).ToArgb())
                    myText.Text = "D17_翻板机"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x70,0xA1,0xFF).ToArgb())
                    myText.Text = "D21_BIMA"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x1E,0x90,0xFF).ToArgb())
                    myText.Text = "D24_小板线"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xFF,0x6B,0x81).ToArgb())
                    myText.Text = "D27_主线装配"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xD1,0xD8,0xE0).ToArgb())
                    myText.Text = "D28_斜封边"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x53,0x52,0xED).ToArgb())
                    myText.Text = "D29_斜边直封边"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x37,0x42,0xFA).ToArgb())
                    myText.Text = "D30_数控钻"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xA4,0xB0,0xBE).ToArgb())
                    myText.Text = "D31_异型直封边"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x74,0x7D,0x8C).ToArgb())
                    myText.Text = "D32_斜边CNC"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x20,0xBF,0x6B).ToArgb())
                    myText.Text = "D34_手封边"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x88,0x54,0xD0).ToArgb())
                    myText.Text = "D37_装毛刷"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x57,0x60,0x6F).ToArgb())
                    myText.Text = "D41_木工加工"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xDF,0xE4,0xEA).ToArgb())
                    myText.Text = "D42_桌子配套"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xCE,0xD6,0xE0).ToArgb())
                    myText.Text = "D44_柜桶组装"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x55,0xEF,0xC4).ToArgb())
                    myText.Text = "D47_柜子组装"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x0,0xB8,0x94).ToArgb())
                    myText.Text = "D51_包装"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xFF,0xEA,0xA7).ToArgb())
                    myText.Text = "D54_配件包装"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xFD,0xCB,0x6E).ToArgb())
                    myText.Text = "M01_剪板"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x81,0xEC,0xEC).ToArgb())
                    myText.Text = "M02_MCG数冲"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x0,0xCE,0xC9).ToArgb())
                    myText.Text = "M03_机械冲"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xFA,0xB1,0xA0).ToArgb())
                    myText.Text = "M04_数控折弯"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xE1,0x70,0x55).ToArgb())
                    myText.Text = "M05_柜身焊接组装线"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x74,0xB9,0xFF).ToArgb())
                    myText.Text = "M06_碰焊机"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x9,0x84,0xE3).ToArgb())
                    myText.Text = "M07_组装包装"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xFF,0x76,0x75).ToArgb())
                    myText.Text = "P01_铝材开料"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xA2,0x9B,0xFE).ToArgb())
                    myText.Text = "P03_冲孔"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x6C,0x5C,0xE7).ToArgb())
                    myText.Text = "P05_铝材CNC"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xFD,0x79,0xA8).ToArgb())
                    myText.Text = "P07_铝材台钻"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xF,0xB9,0xB1).ToArgb())
                    myText.Text = "P21_喷粉"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xDF,0xE6,0xE9).ToArgb())
                    myText.Text = "P31_电子锯"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xEC,0xCC,0x68).ToArgb())
                    myText.Text = "P33_木条EVA"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x63,0x6E,0x72).ToArgb())
                    myText.Text = "P35_钉框EVA"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x0,0xA8,0xFF).ToArgb())
                    myText.Text = "P37_双头锯线"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x0,0x97,0xE6).ToArgb())
                    myText.Text = "P39_直封边"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x2B,0xCB,0xBA).ToArgb())
                    myText.Text = "P41_木器CNC"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x9C,0x88,0xFF).ToArgb())
                    myText.Text = "P43_开布及车布"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x8C,0x7A,0xE6).ToArgb())
                    myText.Text = "P45_扪布线"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xF5,0xF6,0xFA).ToArgb())
                    myText.Text = "P47_无框屏风区"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xDC,0xDD,0xE1).ToArgb())
                    myText.Text = "P71_屏风配套"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xFB,0xC5,0x31).ToArgb())
                    myText.Text = "P73_铝材组装"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xE1,0xB1,0x2C).ToArgb())
                    myText.Text = "P74_铝材包装"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x7F,0x8F,0xA6).ToArgb())
                    myText.Text = "P75_布板组装"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x71,0x80,0x93).ToArgb())
                    myText.Text = "P76_布板包装"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x4C,0xD1,0x37).ToArgb())
                    myText.Text = "P79_屏风配件"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x44,0xBD,0x32).ToArgb())
                    myText.Text = "S02_裁车"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x77,0x8C,0xA3).ToArgb())
                    myText.Text = "S03_开棉"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x48,0x7E,0xB0).ToArgb())
                    myText.Text = "S06_Relate/…"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x40,0x73,0x9E).ToArgb())
                    myText.Text = "S08_Icao/…"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xFC,0x5C,0x65).ToArgb())
                    myText.Text = "S13_Empire"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x4B,0x65,0x84).ToArgb())
                    myText.Text = "S16_HVL640/601"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x45,0xAA,0xF2).ToArgb())
                    myText.Text = "S17_Lucido/…"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x2D,0x98,0xDA).ToArgb())
                    myText.Text = "S18_Mondeno"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xFD,0x96,0x44).ToArgb())
                    myText.Text = "S19_Open Up/…"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xFA,0x82,0x31).ToArgb())
                    myText.Text = "S20_椅子原材料配件"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x4B,0x7B,0xEC).ToArgb())
                    myText.Text = "S21_扫描上卡板"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x88,0x54,0xD0).ToArgb())
                    myText.Text = "T01_TPF数冲"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xFE,0xD3,0x30).ToArgb())
                    myText.Text = "T02_折弯"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xF7,0xB7,0x31).ToArgb())
                    myText.Text = "T03_点焊"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xA5,0x5E,0xEA).ToArgb())
                    myText.Text = "T04_TPF组装"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xF1,0xF2,0xF6).ToArgb())
                    myText.Text = "仓库"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0x26,0xDE,0x81).ToArgb())
                    myText.Text = "办公区"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                else if (clr.ToArgb() == Color.FromArgb(255, 0xFF,0xFF,0xFF).ToArgb())
                    myText.Text = "预留区"+"\r\n"+"当前产量：9999pcs"+"\r\n"+"当前欠货：9999pcs";
                }
            else
            {
                pictureBox1.Cursor = Cursors.Arrow;
                myText.Visible = false; 
                //myText.Text = "其它区域";
            }
            //设置label位置
            if (e.X + 20 + myText.Width >= pictureBox1.Width)
                myText.Left = e.X - 20 - myText.Width;
            else
                myText.Left = e.X + 20;
            if (e.Y + 20 + myText.Height >= pictureBox1.Height)
                myText.Top = e.Y - 20 - myText.Height;
            else
                myText.Top = e.Y + 20;
        }
    }
}